<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>企业</title>
    <link rel="stylesheet" href="css/AllStyle.css" />
    <link rel="stylesheet" href="css/iconfont.css" />
	
    <link rel="stylesheet" href="css/swiper-3.3.1.min.css" />
    <link rel="stylesheet" href="css/font-awesome.css" />
    <script type="text/javascript" src="js/common.js" ></script>
    <script type="text/javascript" src="js/data.js" ></script>
    <script type="text/javascript" src="js/tmpl.js" ></script>
</head>
<body>
<section style="width: 100%;height:100%;position: absolute;overflow: hidden;">
	<section class="FormBlockOne">
		<nav>
			<span id="LogoButtom"><img width="50%" style="margin:20px auto;display: block;" src="images/logo.png"></span>
			<ul class="HomeNavLeft">
				<li class="username"><i class="iconfont icon-user"  ></i></li>
				<!-- <li class="videoClassify"><i class="iconfont icon-icon"></i>扫描发货</li>
				<li class="lot"><i class="iconfont icon-iconfontdaifahuo"></i>批量发货</li>
				<li class="query"><i class="iconfont icon-chaxun"></i>查询标签</li> -->
				<li class="ChangePassword"><i class="iconfont icon-xiugai"></i>修改密码</li>
				<li class="logout"><i class="iconfont icon-tuichu"></i>退出登录</li>
			</ul>
		</nav>
	</section>
	<div id="SlideMaskLayer"></div>
	
	<section class="FormBlockTwo" id="FormBlockTwo">
		
		<!-- 页眉 -->
	    <section>
		    <script type="text/javascript">
		        writePageHeader('首页');
		    </script>
	    </section>
	    
	    <!-- 内容 -->
	    <section class="AllContent" id="pullrefresh">
	    	<div class="SiteMain">
	    		<!-- 焦点图 -->
<!-- 			    <section>
				    <script type="text/javascript">
				        FocusPicture();
				    </script>
			    </section> -->
			    
	    		<div class="SiteMainHeader">
	    			<ul>
						<li>
							<p>订单总数</p>
							<p> </p>
						</li>
						<li ><i class="iconfont icon-biaoqian"></i>&nbsp;<i id="productCount">353</i></li>
					</ul>
					
					<ul>
						<li>
							<p>产线计划数 </p>
							<p> </p>
						</li>
						<li style="color:#00a9ed;"><i class="iconfont icon-mapwangdian"></i>&nbsp;<i id="branchCount">10</i></li>
					</ul>
	    		</div>
	    		
	    		<p style="height:5px;background-color: #f3f3f3;"></p>
	    		
	    		<div class="SiteMainBlock">
	    			<ul>

	    				<li class="burn">
							<p><i class="fa fa-edit"></i>
	    					<p>烧写秘钥</p>
	    				</li>
	    				<li class="addHandle">
	    					<p><i class="iconfont icon-inv-add"></i></im></p>
	    					<p>增配手柄</p>
	    				</li>
	    				<li class="testReport">
	    					<p><i class="iconfont icon-fafangtongji"></i></im></p>
	    					<p>电机测试报告</p>
	    				</li>
	    				<li class="package_lot">
	    					<p><i class="fa fa-suitcase"></i></im></p>
	    					<p>装箱喷码</p>
	    				</li>
	    				<!-- <li class="tag_pack">
	    					<p><i class="fa fa-inbox"></i></im></p>
	    					<p>订单计划</p>
	    				</li> -->
	    				<li class="#">
	    					<p><i class="fa fa-wrench"></i></im></p>
	    					<p>设置</p>
	    				</li>
						<li class="#">
							<p><i class="iconfont icon-tuichu"></i></im></p>
							<p>退出</p>
						</li>
	    			<!--	<li class="packagestat">
	    					<p><i class="fa fa-bar-chart-o"></i></im></p>
	    					<p>打包统计</p>
	    				</li>
	    				<li class="stocklist">
	    					<p><i class="iconfont icon-fahuokucun"></i></im></p>
	    					<p>库存查询</p>
	    				</li>
	    				<li class="ProductsList">
	    					<p><i class="iconfont icon-inv-add"></i></im></p>
	    					<p>商品列表</p>
	    				</li>
	    				<li class="ScreentoneList">
	    					<p><i class="iconfont icon-didian"></i></im></p>
	    					<p>网点列表</p>
	    				</li> -->
	    				<!--<li class="picasa">
	    					<p><i class="iconfont icon-tupian"></i></im></p>
	    					<p>图片管理</p>
	    				</li>-->
<!-- 	    				<li class="CompanyTraceability">
	    					<p><i class="iconfont icon-fafangtongji"></i></im></p>
	    					<p>溯源过程</p>
	    				</li>
	    				<li class="ScanStatistics">
	    					<p><i class="iconfont icon-icon"></i></im></p>
	    					<p>扫描统计</p>
	    				</li>
	    				<li class="ConsignmentReport">
	    					<p><i class="iconfont icon-tongjifenxi-copy"></i></im></p>
	    					<p>发货统计</p>
	    				</li> -->

	    				<!--<li class="AddBlock">
	    					<p style="color:#666"><i class="iconfont icon-tianjia"></i></i></p>
	    					<p style="color:#666">添加</p>
	    				</li>-->
	    			</ul>
	    		</div>
	    		
	    		<p class="CopyRight">AL-MES系统 V1.0<i></i></p>
	    	
	    	</div>
	    </section>
	</section>
</section>
</body>
<script type="text/javascript" src="js/jquery.min.js" ></script>
<script type="text/javascript" src="js/swiper-3.3.1.min.js" ></script>
<script type="text/javascript" src="js/mui.min.js" ></script>
<script type="text/javascript" src="js/AllJS.js" ></script>
<script type="text/javascript" src="js/echarts/common.js" ></script>
<script type="text/javascript" src="js/update.js" ></script>
<script type="text/javascript">
	
	var showMenu = false;
    mui.init({
		pullRefresh: {
			container: '#pullrefresh',
			down: {
				contentdown : "<div style='text-align:center;fonr-size:0.95em;color:#ccc;'>下拉刷新</div>",
			    contentover : '<div style="width:100%;background:#fff;"><img style="width: 20%;margin:0px auto;display:block;" src="images/loading5_.jpg" /><p style="text-align:center;color:#777;padding:5px 0px;">释放加载...</p></div>',
			    contentrefresh : '<div style="width:100%;background:#fff;"><img style="width: 20%;margin:0px auto;display:block;" src="images/loading5.gif" /><p style="text-align:center;color:#777;padding:5px 0px;">正在加载...</p></div>',
				callback: pullupRefresh,
			}
		}
	});
	
	function pullupRefresh() {
        $("#productCount").text(0);
        $("#branchCount").text(0);
				document.addEventListener('deviceready', onDeviceReady, true);
        $.ajax({//一个Ajax过程
            type: "post", //以post方式与后台沟通
            url: getServerUrl() + "/Open/ComStat/index", //与此php页面沟通
            dataType: 'json', //从php返回的值以 JSON方式 解释
            data: 'access_token=' + getToken(),
            success: function (json) {//如果调用php成功
                if(json.result == "1"){
                    $("#productCount").text(json.tag_total);
                    $("#branchCount").text(json.branch_total);
        			$('.AllContent').css({backgroundColor:'#f3f3f3'});
		
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
		
                }else{
                    alertMessage(json_error_description);
                }

            }
        });
	}
    
  	var publicity = new Swiper('.swiper-publicity',{
		autoplay: 3000
	});
	
	var clickNum = 1;
	$('.AddBlock').on('tap',function(){
		if(clickNum == 1){
			$(this).find('p:eq(0)').css({transform:'rotate(360deg)',transition:'All 1s ease-in-out',color:'#ccc'});
			$(this).find('p:eq(1)').text('没有更多').css({transition:'All 1s ease-in-out',color:'#ccc'});
			clickNum++;
		}else{
			$(this).find('p:eq(0)').css({transform:'rotate(-360deg)',transition:'All 1s ease-in-out',color:'#666'});
			$(this).find('p:eq(1)').text('添加').css({transition:'All 1s ease-in-out',color:'#666'});
			clickNum--;
		}
	});
	
	$('#CtyQuery').on('tap',function(){
		mui.openWindow({
			 url: 'query.html', 
		    id:'query.html'
		});
	});

	jQuery(function () {
					$('.username').text(getCookie("username"));
					$("#homepagemessageid").hide();
	        $("#homepagemessageid").html("");
					document.addEventListener('deviceready', onDeviceReady, true);
	        $.ajax({//一个Ajax过程
	            type: "post", //以post方式与后台沟通
	            url: getServerUrl() + "/Open/ComStat/index", //与此php页面沟通
	            dataType: 'json', //从php返回的值以 JSON方式 解释
	            data: 'access_token=' + getToken(),
	            success: function (json) {//如果调用php成功
	                if(json.result == "1"){
	                    $("#productCount").text(json.tag_total);
	                    $("#branchCount").text(json.branch_total);
	                }else{
	                    alertMessage(json_error_description);
	                }
	
	            }
	        });
	        
	        var u = navigator.userAgent, app = navigator.appVersion;
			var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
			var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
			
			if (+isAndroid) {
				
		    	$('.SiteMain').css({marginTop:'0px'});
		    	var ScrollTop = $('#pullrefresh').scrollTop();
				if(ScrollTop == 0){
			    	$('#pullrefresh').on('swipedown',function(){
				        $("#productCount").text(0);
				        $("#branchCount").text(0);
				        $('#pullrefresh').prepend('<div id="AddLoading" style="width:100%;background:#fff;"><img style="width: 20%;margin:0px auto;display:block;" src="images/loading5.gif" /><p style="text-align:center;color:#777;padding:5px 0px;">正在加载...</p></div>');
			    		$('#pullrefresh').animate({scrollTop:0},500);
			    		$.ajax({//一个Ajax过程
				            type: "post", //以post方式与后台沟通
				            url: getServerUrl() + "/Open/ComStat/index", //与此php页面沟通
				            dataType: 'json', //从php返回的值以 JSON方式 解释
				            data: 'access_token=' + getToken(),
				            success: function (json) {//如果调用php成功
				                if(json.result == "1"){
				                    $("#productCount").text(json.tag_total);
				                    $("#branchCount").text(json.branch_total);
				        			$('.AllContent').css({backgroundColor:'#f3f3f3'});
									$('#AddLoading').remove();
						
				                }else{
				                    alertMessage(json_error_description);
				                }
				
				            }
				        });
			    	});
				}
				
			}else{
				$('.SiteMain').css({marginTop:'-23px'});
			}
	    });
	    function onDeviceReady() {
	        //autoCheckAppVersion();
	        document.addEventListener("backbutton", onBackKeyDown, false);
	    }
	    function onBackKeyDown() {
	        hideLoading();
	        // Handle the back button
	        exitFromApp();
	    }
	
	    function onsuccess() {
	    }
	    function proccessTextQuery() {
	        if(!empty($("#itemcode").val())) {
	            loadUrl("query.html", "itemcode", $("#itemcode").val());
	        }else {
	            alert("请输入产品编号！");
	        }
	
	    }
	
	$(function(){
		//扫描器
		$(".Scanner").on('tap',function(){
		  mui.openWindow({
		    url: 'Scanner.html?etk=3', 
		    id:'Scanner.html'
		  });
		});
		
		$('.SiteMainBlock ul li').on('tap',function(){
			var val = $(this).attr('class')
			mui.openWindow({
				url: val+'.html', 
				id:val+'.html'
			});
		})
		
		$(".logout").on('tap',function(){
		  logout();
		});
		
	});
	
	mui.plusReady(function() {
	    //首页返回键处理
		//处理逻辑：1秒内，连续两次按返回键，则退出应用；
		var first = null;
		mui.back = function() {
			if (showMenu) {
				closeMenu();
			} else {
				//首次按键，提示‘再按一次退出应用’
				if (!first) {
					first = new Date().getTime();
					mui.toast('再按一次退出应用');
					setTimeout(function() {
						first = null;
					}, 1000);
				} else {
					if (new Date().getTime() - first < 1000) {
						plus.runtime.quit();
					}
				}
			}
		};
	});
	
	mui.init({
	  preloadPages:[
	    {
	      url:'ChangePassword.html',
	      id:'ChangePassword.html'
	    }
	  ]
	});
	
</script>
</html>